using ERP.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;
using Volo.Abp.MultiTenancy;

namespace ERP.Permissions;

public class ERPPermissionDefinitionProvider : PermissionDefinitionProvider
{
    public override void Define(IPermissionDefinitionContext context)
    {
        //var myGroup = context.AddGroup(ERPPermissions.GroupName);

        var ERPGroup = context.AddGroup(ERPPermissions.GroupName, L("Permission:ERP"));

        var materialtypePermission = ERPGroup.AddPermission(ERPPermissions.MaterialType.Default, L("Permission:MaterialType"));
        materialtypePermission.AddChild(ERPPermissions.MaterialType.Create, L("Permission:MaterialType.Create"));
        materialtypePermission.AddChild(ERPPermissions.MaterialType.Edit, L("Permission:MaterialType.Edit"));
        materialtypePermission.AddChild(ERPPermissions.MaterialType.Delete, L("Permission:MaterialType.Delete"));


    }

    private static LocalizableString L(string name)
    {
        return LocalizableString.Create<ERPResource>(name);
    }
}
